package com.dingreading.cloud.soms.api;

import com.dingreading.cloud.soms.service.CaClassService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/class")
public class ClassApiController {

    @Resource
    private CaClassService classService;

    @ApiOperation(value = "社团是否使用阶段")
    @GetMapping(value = "/haveStageUid", produces = "application/json; charset=UTF-8")
    public boolean haveStageUid(
            @ApiParam(value = "阶段uid") @RequestParam(value = "stageUid") String stageUid
    ) throws Exception {

        boolean b = classService.haveStageUid(null, stageUid);
        return b;
    }

    @ApiOperation(value = "社团是否使用项目")
    @GetMapping(value = "/haveProjectUid", produces = "application/json; charset=UTF-8")
    public boolean haveProjectUid(
            @ApiParam(value = "项目uid") @RequestParam(value = "projectUid") String projectUid
    ) throws Exception {
        boolean b = classService.haveProjectUid(null, projectUid);
        return b;
    }

}
